<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<!--    用于解析ES6-->
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    <style>
        .red {
            color: red;
        }
    </style>
</head>
<!--ES6 -->
<!--事件处理-->
<!--state-->
<body>
    <div id="app"></div>
    <script type="text/babel">
        class Hello extends React.Component {
            constructor(props) {
                super(props);
                this.state =  {
                    name: 'aa',
                    age: 19,
                    sex: '男'
                }
            }
            updateUserInfo = () => {
                console.log('pppp')
                // 不是赋值
                this.setState({
                    name:'bb',
                    age: 18
                })
            }
            render() {
                return <div>
                    <h1>state</h1>
                    <p>姓名{this.state.name}</p>
                    <p>年龄{this.state.age}</p>
                    <p>性别{this.state.sex}</p>
                    <button onClick={this.updateUserInfo}>更新数据</button>
                </div>
            }
        }
        ReactDOM.render(<Hello/>,document.getElementById('app'))
    </script>
</body>
</html>